import Vue from "vue";
import VueRouter from "vue-router";
const routerPush = VueRouter.prototype.push;
console.log("old-routerPush", routerPush);
VueRouter.prototype.push = function push(location) {
  return routerPush
    .call(this, location)
    .catch((error) => console.log("error", error));
};
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: () => import("../views/Home.vue"),
    meta: {
      title: "首页",
    },
    redirect: {
      name: "studyIndex",
    },
    children: [
      {
        path: "/studyIndex",
        name: "studyIndex",
        component: () => import("../views/studyIndex/Index.vue"),
        meta: {
          title: "首页",
        },
      },
      {
        path: "/overallReport",
        name: "overallReport",
        component: () => import("../views/overallReport/Index.vue"),
        meta: {
          title: "总体报告",
        },
      },
      {
        path: "/studyReport",
        name: "studyReport",
        component: () => import("../views/studyReport/index.vue"),
        meta: {
          title: "今日学情概览",
        },
      },
      {
        path: "/word",
        name: "word",
        component: () => import("../views/word/Index.vue"),
        meta: {
          title: "单词速记王",
        },
        redirect: {
          name: "studyCenter",
        },
        children: [
          {
            path: "/word/studyCenter",
            name: "studyCenter",
            component: () => import("../views/word/studyCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/word/memory",
            name: "memory",
            component: () => import("../views/word/memory/Index.vue"),
            meta: {
              title: "记忆",
            },
          },
          {
            path: "/word/wordListen",
            name: "wordListen",
            component: () => import("../views/word/wordListen/Index.vue"),
            meta: {
              title: "词听",
            },
          },
          {
            path: "/word/dictation",
            name: "dictation",
            component: () => import("../views/word/dictation/Index.vue"),
            meta: {
              title: "听写",
            },
          },
          {
            path: "/word/writeMemory",
            name: "writeMemory",
            component: () => import("../views/word/writeMemory/Index.vue"),
            meta: {
              title: "默写",
            },
          },
          {
            path: "/word/quickTest",
            name: "quickTest",
            component: () => import("../views/word/testPaper/QuickTest.vue"),
            meta: {
              title: "极速测试",
            },
          },
          {
            path: "/word/generalTest",
            name: "generalTest",
            component: () => import("../views/word/testPaper/GeneralTest.vue"),
            meta: {
              title: "普通测试",
            },
          },
          {
            path: "/word/printTest",
            name: "printTest",
            component: () => import("../views/word/testPaper/printTest.vue"),
            meta: {
              title: "打印试卷",
            },
          },
          {
            path: "/word/testReport",
            name: "testReport",
            component: () => import("../views/word/testPaper/TestReport.vue"),
            meta: {
              title: "测试报告",
            },
          },
          {
            path: "/word/testCenter",
            name: "testCenter",
            component: () => import("../views/word/testCenter/Index.vue"),
            meta: {
              title: "测试中心",
            },
          },
          {
            path: "/word/testRecord",
            name: "testRecord",
            component: () =>
              import("../views/word/testCenter/testRecord/Index.vue"),
            meta: {
              title: "测试记录",
            },
          },
          {
            path: "/word/wordBook",
            name: "wordBook",
            component: () => import("../views/word/wordBook/Index.vue"),
            meta: {
              title: "单词本",
            },
          },
          {
            path: "/word/memoryReview",
            name: "memoryReview",
            component: () => import("../views/word/memoryReview/Index.vue"),
            meta: {
              title: "记忆追踪",
            },
          },
          {
            path: "/word/progressCourse",
            name: "progressCourse",
            component: () => import("../views/word/progressCourse/Index.vue"),
            meta: {
              title: "课程进度",
            },
          },
          {
            path: "/word/correctWrong",
            name: "correctWrong",
            component: () => import("../views/word/correctWrong/Index.vue"),
            meta: {
              title: "错题订正",
            },
          },
        ],
      },
      {
        path: "/vocabulary",
        name: "vocabulary",
        component: () => import("../views/vocabulary/index.vue"),
        meta: {
          title: "单词量测试",
        },
        redirect: {
          name: "vocabularyCenter",
        },
        children: [
          {
            path: "/vocabulary/vocabularyCenter",
            name: "vocabularyCenter",
            component: () =>
              import("../views/vocabulary/vocabularyCenter/index.vue"),
            isHidden: true,
            meta: {
              title: "单词量测试中心",
            },
          },
          {
            path: "/vocabulary/vocabularyTest",
            name: "vocabularyTest",
            component: () =>
              import("../views/vocabulary/vocabularyTest/index.vue"),
            isHidden: true,
            meta: {
              title: "单词量测试",
            },
          },
        ],
      },
      {
        path: "/wordBank",
        name: "wordBank",
        component: () => import("../views/wordBank/index.vue"),
        meta: {
          title: "单词库",
        },
        redirect: {
          name: "wordBankCenter",
        },
        children: [
          {
            path: "/wordBank/wordBankCenter",
            name: "wordBankCenter",
            component: () =>
              import("../views/wordBank/wordBankCenter/index.vue"),
            isHidden: true,
            meta: {
              title: "单词库学习中心",
            },
          },
        ],
      },
      {
        path: "/experientialWord",
        name: "experientialWord",
        component: () => import("../views/experientialWord/index.vue"),
        meta: {
          title: "体验单词库",
        },
        redirect: {
          name: "experientialStudyCenter",
        },
        children: [
          {
            path: "/experientialWord/experientialStudyCenter",
            name: "experientialStudyCenter",
            component: () =>
              import("../views/experientialWord/experientialStudyCenter/index.vue"),
            isHidden: true,
            meta: {
              title: "体验单词库学习中心",
            },
          },
        ],
      },
      {
        path: "/text",
        name: "text",
        component: () => import("../views/syncText/Index.vue"),
        meta: {
          title: "同步课文",
        },
        redirect: {
          name: "textStudyCenter",
        },
        children: [
          {
            path: "/text/studyCenter",
            name: "textStudyCenter",
            component: () => import("../views/syncText/studyCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/text/textBook",
            name: "textBook",
            component: () => import("../views/syncText/textBook/Index.vue"),
            meta: {
              title: "课文本",
            },
          },
          {
            path: "/text/exerciseRead",
            name: "exerciseRead",
            component: () => import("../views/syncText/exerciseRead/Index.vue"),
            meta: {
              title: "跟读训练",
            },
          },
          {
            path: "/text/exerciseRecite",
            name: "exerciseRecite",
            component: () =>
              import("../views/syncText/exerciseRecite/Index.vue"),
            meta: {
              title: "背诵训练",
            },
          },
          {
            path: "/text/testPaper",
            name: "textTestPaper",
            component: () => import("../views/syncText/testPaper/Index.vue"),
            meta: {
              title: "闯关测试",
            },
          },
          {
            path: "/text/testReport",
            name: "textTestReport",
            component: () => import("../views/syncText/testReport/Index.vue"),
            meta: {
              title: "测试报告",
            },
          },
        ],
      },
      {
        path: "/question",
        name: "question",
        component: () => import("../views/syncQuestion/Index.vue"),
        meta: {
          title: "同步练习",
        },
        redirect: {
          name: "questionStudyCenter",
        },
        children: [
          {
            path: "/question/studyCenter",
            name: "questionStudyCenter",
            component: () =>
              import("../views/syncQuestion/studyCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/question/practice",
            name: "questionPractice",
            component: () =>
              import("../views/syncQuestion/questionPractice/Index.vue"),
            meta: {
              title: "随堂练习",
            },
          },
          {
            path: "/question/testPaper",
            name: "questionTestPaper",
            component: () =>
              import("../views/syncQuestion/testPaper/Index.vue"),
            meta: {
              title: "闯关测试",
            },
          },
        ],
      },
      {
        path: "/sentence",
        name: "sentence",
        component: () => import("../views/sentence/Index.vue"),
        meta: {
          title: "同步句子",
        },
        redirect: {
          name: "sentenceStudyCenter",
        },
        children: [
          {
            path: "/sentence/studyCenter",
            name: "sentenceStudyCenter",
            component: () => import("../views/sentence/studyCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/sentence/sentenceExamples",
            name: "sentenceExamples",
            component: () =>
              import("../views/sentence/sentenceExamples/Index.vue"),
            meta: {
              title: "听音组句",
            },
          },
          {
            path: "/sentence/sentenceHearListen",
            name: "sentenceHearListen",
            component: () =>
              import("../views/sentence/sentenceHearListen/Index.vue"),
            meta: {
              title: "听力理解",
            },
          },
          {
            path: "/sentence/sentenceTranslation",
            name: "sentenceTranslation",
            component: () =>
              import("../views/sentence/sentenceTranslation/Index.vue"),
            meta: {
              title: "连词成句",
            },
          },
          {
            path: "/sentence/sentenceWrite",
            name: "sentenceWrite",
            component: () =>
              import("../views/sentence/sentenceWrite/Index.vue"),
            meta: {
              title: "句子默写",
            },
          },
          {
            path: "/sentence/testCenter",
            name: "sentenceTestCenter",
            component: () => import("../views/sentence/testCenter/Index.vue"),
            meta: {
              title: "测试中心",
            },
          },
          {
            path: "/sentence/printTest",
            name: "sentencePrintTest",
            component: () =>
              import("../views/sentence/testCenter/printTest.vue"),
            meta: {
              title: "打印试卷",
            },
          },
          {
            path: "/sentence/testRecord",
            name: "sentenceTestRecord",
            component: () =>
              import("../views/sentence/testCenter/testRecord/Index.vue"),
            meta: {
              title: "测试记录",
            },
          },
          {
            path: "/sentence/sentenceTest",
            name: "sentenceTest",
            component: () =>
              import("../views/sentence/testPaper/SentenceTest.vue"),
            meta: {
              title: "句子测试",
            },
          },
          {
            path: "/sentence/sentenceBook",
            name: "sentenceBook",
            component: () => import("../views/sentence/sentenceBook/Index.vue"),
            meta: {
              title: "句子本",
            },
          },
          {
            path: "/sentence/testReport",
            name: "sentenceTestReport",
            component: () =>
              import("../views/sentence/testPaper/TestReport.vue"),
            meta: {
              title: "测试报告",
            },
          },
          {
            path: "/sentence/memoryReview",
            name: "sentenceMemoryReview",
            component: () => import("../views/sentence/memoryReview/Index.vue"),
            meta: {
              title: "记忆追踪",
            },
          },
          {
            path: "/sentence/progressCourse",
            name: "sentenceProgressCourse",
            component: () =>
              import("../views/sentence/progressCourse/Index.vue"),
            meta: {
              title: "课程进度",
            },
          },
          {
            path: "/sentence/correctWrong",
            name: "sentenceCorrectWrong",
            component: () => import("../views/sentence/correctWrong/Index.vue"),
            meta: {
              title: "错题订正",
            },
          },
        ],
      },
      {
        path: "/read",
        name: "read",
        component: () => import("../views/read/Index.vue"),
        meta: {
          title: "阅读",
        },
        redirect: {
          name: "readCenter",
        },
        children: [
          {
            path: "/read/readCenter",
            name: "readCenter",
            component: () => import("../views/read/readCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/read/intelligentTrain",
            name: "intelligentTrain",
            component: () => import("../views/read/IntelligentTrain/Index.vue"),
            meta: {
              title: "智能训练",
            },
          },
          {
            path: "/read/proficiencyTest",
            name: "proficiencyTest",
            component: () => import("../views/read/proficiencyTest/Index.vue"),
            meta: {
              title: "水平测试",
            },
          },
          {
            path: "/read/readTestList",
            name: "readTestList",
            component: () => import("../views/read/readTestList/Index.vue"),
            meta: {
              title: "我的试题",
            },
          },
        ],
      },
      {
        path: "/individuationRead",
        name: "individuationRead",
        component: () => import("../views/individuationRead/index.vue"),
        meta: {
          title: "个性化阅读",
        },
        redirect: {
          name: "individuationReadTest",
        },
        children: [
          {
            path: "/individuationRead/individuationReadCenter",
            name: "individuationReadCenter",
            component: () =>
              import(
                "../views/individuationRead/individuationReadCenter/index.vue"
              ),
            isHidden: true,
            meta: {
              title: "个性化阅读中心",
            },
          },
          {
            path: "/individuationRead/individuationReadTest",
            name: "individuationReadTest",
            component: () =>
              import(
                "../views/individuationRead/individuationReadTest/index.vue"
              ),
            isHidden: true,
            meta: {
              title: "个性化阅读单词",
            },
          },
          {
            path: "/individuationRead/printWord",
            name: "printWord",
            component: () =>
              import("../views/individuationRead/printWord/index.vue"),
            isHidden: true,
            meta: {
              title: "打印单词表",
            },
          },
        ],
      },
      {
        path: "/correctionNotebook",
        name: "correctionNotebook",
        component: () => import("../views/correctionNotebook/index.vue"),
        meta: {
          title: "错题本",
        },
        redirect: {
          name: "notebook",
        },
        children: [
          {
            path: "/correctionNotebook/notebook",
            name: "notebook",
            component: () =>
              import("../views/correctionNotebook/notebook/index.vue"),
            isHidden: true,
            meta: {
              title: "错题中心",
            },
          }, {
            path: "/correctionNotebook/notebookTest",
            name: "notebookTest",
            component: () =>
              import("../views/correctionNotebook/notebook/notebookTest.vue"),
            isHidden: true,
            meta: {
              title: "错题巩固",
            },
          },
        ],
      },
      {
        path: "/grammar",
        name: "grammar",
        component: () => import("../views/grammar/Index.vue"),
        meta: {
          title: "语法通",
        },
        redirect: {
          name: "grammerVideo",
        },
        children: [
          {
            path: "/grammar/grammerVideo",
            name: "grammerVideo",
            component: () => import("../views/grammar/grammerVideo/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/grammar/grammerQuestion",
            name: "grammarQuestion",
            component: () =>
              import("../views/grammar/grammerVideo/grammarQuestion.vue"),
            meta: {
              title: "闯关练习",
            },
          },
          {
            path: "/grammar/grammarTestList",
            name: "grammarTestList",
            component: () =>
              import("../views/grammar/grammarTestList/Index.vue"),
            meta: {
              title: "测试记录",
            },
          },
        ],
      },
      {
        path: "/naturalSpell",
        name: "naturalSpell",
        component: () => import("../views/naturalSpell/Index.vue"),
        meta: {
          title: "自然拼读",
        },
        redirect: {
          name: "naturalSpellCenter",
        },
        children: [
          {
            path: "/naturalSpell/studyCenter",
            name: "naturalSpellCenter",
            component: () =>
              import("../views/naturalSpell/studyCenter/Index.vue"),
            isHidden: true,
            meta: {
              title: "学习中心",
            },
          },
          {
            path: "/naturalSpell/spellStudy",
            name: "spellStudy",
            component: () =>
              import("../views/naturalSpell/spellStudy/Index.vue"),
            meta: {
              title: "拼读学习",
            },
          },
          {
            path: "/naturalSpell/readWord",
            name: "readWord",
            component: () => import("../views/naturalSpell/readWord/index.vue"),
            meta: {
              title: "见词能读",
            },
          },
          {
            path: "/naturalSpell/readWordFast",
            name: "readWordFast",
            component: () =>
              import("../views/naturalSpell/readWordFast/index.vue"),
            meta: {
              title: "见词能读快速版",
            },
          },
          {
            path: "/naturalSpell/dictationFast",
            name: "dictationFast",
            component: () =>
              import("../views/naturalSpell/dictationFast/Index.vue"),
            meta: {
              title: "听音能写快速版",
            },
          },
          {
            path: "/naturalSpell/writeWord",
            name: "writeWord",
            component: () =>
              import("../views/naturalSpell/writeWord/index.vue"),
            meta: {
              title: "听音能写",
            },
          },
          {
            path: "/naturalSpell/listenTest",
            name: "spellListenTest",
            component: () =>
              import("../views/naturalSpell/listenTest/Index.vue"),
            meta: {
              title: "听读测验",
            },
          },
          {
            path: "/naturalSpell/testAfterStudy",
            name: "spellTestAfterStudy",
            component: () =>
              import("../views/naturalSpell/testAfterStudy/Index.vue"),
            meta: {
              title: "学后闯关",
            },
          },
        ],
      },
      // 收藏中心
      {
        path: "/collectCenter",
        name: "collectCenter",
        component: () => import("../views/collectCenter"),
        meta: {
          title: "收藏中心",
        },
        redirect: {
          name: "collectRead",
        },
        children: [
          {
            path: "/collectCenter/collectRead",
            name: "collectRead",
            component: () => import("../views/collectCenter/collectRead"),
            meta: {
              title: "阅读",
            },
          },
          {
            path: "/collectCenter/personalizedRead",
            name: "personalizedRead",
            component: () => import("../views/collectCenter/personalizedRead"),
            meta: {
              title: "个性化阅读",
            },
          },
          {
            path: "/collectCenter/synchronousExercise",
            name: "synchronousExercise",
            component: () =>
              import("../views/collectCenter/synchronousExercise"),
            meta: {
              title: "同步练习",
            },
          },
        ],
      },
      {
        path: "/homework",
        name: "homework",
        component: () => import("../views/homework/index.vue"),
        meta: {
          title: "作业中心",
        },
        redirect: {
          name: "homeworkCenter",
        },
        children: [
          {
            path: "/homework/homeworkCenter",
            name: "homeworkCenter",
            component: () => import("../views/homework/homeworkCenter.vue"),
            meta: {
              title: "试卷管理",
            },
          },
          {
            path: "/homework/testPaper",
            name: "testPaper",
            component: () => import("../views/homework/Paper.vue"),
            meta: {
              title: "考试试卷",
            },
          },
        ],
      },
      {
        path: "/functionCenter",
        name: "functionCenter",
        component: () => import("../views/functionCenter/Index.vue"),
        meta: {
          title: "功能中心",
        },
        redirect: {
          name: "help",
        },
        children: [
          {
            path: "/functionCenter/help",
            name: "help",
            component: () => import("../views/functionCenter/help/Index.vue"),
            meta: {
              title: "帮助",
            },
          },
          {
            path: "/functionCenter/game",
            name: "game",
            component: () => import("../views/functionCenter/game/Index.vue"),
            meta: {
              title: "小游戏",
            },
          },
          {
            path: "/functionCenter/typingGame",
            name: "typingGame",
            component: () =>
              import("../views/functionCenter/typingGame/index.vue"),
            meta: {
              title: "键盘练习",
            },
            redirect: {
              name: "typingGameCenter",
            },
            children: [
              {
                path: "/functionCenter/typingGame/typingGameCenter",
                name: "typingGameCenter",
                component: () =>
                  import(
                    "../views/functionCenter/typingGame/typingGameCenter/index.vue"
                  ),
              },
              {
                path: "/functionCenter/typingGame/preselectionPractice",
                name: "preselectionPractice",
                component: () =>
                  import(
                    "../views/functionCenter/typingGame/preselectionPractice/index.vue"
                  ),
              },
              {
                path: "/functionCenter/typingGame/typingGameCenterPractice",
                name: "typingGameCenterPractice",
                component: () =>
                  import(
                    "../views/functionCenter/typingGame/typingGameCenterPractice/index.vue"
                  ),
              },
            ],
          },
          {
            path: "/functionCenter/keyboardGame",
            name: "keyboardGame",
            component: () =>
              import("../views/functionCenter/keyboardGame/Index.vue"),
            meta: {
              title: "键盘游戏",
            },
          },
          {
            path: "/functionCenter/keyboard",
            name: "keyboard",
            component: () =>
              import("../views/functionCenter/keyboard/Index.vue"),
            meta: {
              title: "键盘训练",
            },
            redirect: {
              name: "keyboard1",
            },
            children: [
              {
                path: "/functionCenter/keyboard/page1",
                name: "keyboard1",
                component: () =>
                  import("../views/functionCenter/keyboard/page1/page1.vue"),
              },
              {
                path: "/functionCenter/keyboard/page2",
                name: "keyboard2",
                component: () =>
                  import("../views/functionCenter/keyboard/page2/page2.vue"),
              },
              {
                path: "/functionCenter/keyboard/page3",
                name: "keyboard3",
                component: () =>
                  import("../views/functionCenter/keyboard/page3/page3.vue"),
              },
              {
                path: "/functionCenter/keyboard/page4",
                name: "keyboard4",
                component: () =>
                  import("../views/functionCenter/keyboard/page4/page4.vue"),
              },
            ],
          },
        ],
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/Login.vue"),
    meta: {
      title: "登录",
    },
  },
];

const router = new VueRouter({
  routes,
});

export default router;
